const low = require('lowdb');
const FileSync = require('lowdb/adapters/FileSync');
const path = require('path');

// class SessionDb {
//   constructor() {
//     const { appName } = process.env;
//     const filePath = path.join(__dirname, `../../data/session.${appName}.json`);
//     const adapter = new FileSync(filePath);
//     const sessionDb = low(adapter);

//     sessionDb.defaults({ session: {}, user: {} }).write();

//     this.db = sessionDb;
//   }
// }

// module.exports = SessionDb;

const { appName } = process.env;
const filePath = path.join(__dirname, `../../data/session.${appName}.json`);
const adapter = new FileSync(filePath);
const sessionDb = low(adapter);

sessionDb.defaults({ session: {}, user: {} }).write();

module.exports = sessionDb;
